package cn.dengta.webapp.trade.model;

import cn.dengta.common.model.ValueProxy;
import cn.dengta.context.model.LabelI18nProxy;
import lombok.Getter;

import static cn.dengta.context.model.TradeEnumI18nKey.*;

@Getter
public enum HandleStatus implements LabelI18nProxy<HandleStatus, Integer> {

	/** 失败 */
	FAIL(-9, HANDLE_STATUS_FAIL),
	/** 拒绝发放 */
	DENY(-1, "成功"),
	/** 待处理 */
	INIT(0, HANDLE_STATUS_INIT),
	/** 处理中 */
	PENDING(1, HANDLE_STATUS_PENDING),
	/** 成功 */
	DONE(9, HANDLE_STATUS_DONE);

	final ValueProxy<HandleStatus, Integer> proxy;

	// 构造函数，枚举类型只能为私有
	HandleStatus(Integer value, String label) {
		this.proxy = new ValueProxy<>(this, value, label);
	}

	public static HandleStatus[] getValues() {
		return ValueProxy.getCachedArray(HandleStatus.class, HandleStatus::values);
	}

	public static HandleStatus of(Integer value) {
		return INIT.getValueOf(value);
	}

}
